package com.mezz.bones.user.application.repository.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mezz.bones.framework.base.domain.enums.ResponseCode;
import com.mezz.bones.framework.base.exception.BaseException;
import com.mezz.bones.user.application.mapper.ISysMenuMapper;
import com.mezz.bones.user.application.repository.ISysMenuRepository;
import com.mezz.bones.user.client.domain.entity.SysMenu;
import org.springframework.stereotype.Service;

@Service
public class SysMenuRepositoryImpl extends ServiceImpl<ISysMenuMapper, SysMenu> implements ISysMenuRepository {

    @Override
    public SysMenu getByIdWithException(String id) {

        SysMenu sysMenu = this.getById(id);
        if(sysMenu == null) {
            throw new BaseException(ResponseCode.DATA_NOT_FOUND, "菜单不存在");
        }

        return sysMenu;
    }
}